#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
struct Node {
  int x, y;
  bool operator<(const Node& o) const { return y < o.y; }
} a[N];
bool check() {
  if (a[1].y == a[n].y) {
    int positive = 0, negative = 0;
    rep(i, 1, n) {
      if (a[i].x > 0)
        positive++;
      else
        negative++;
    }
    return !positive || !negative || abs(positive - negative) <= 1;
  }
  rep(i, 2, n - 1) {
    if (1ll * a[i].x * a[i].x != 1ll * a[i - 1].x * a[i + 1].x) return false;
  }
  return true;
}
void solve() {
  cin >> n;
  rep(i, 1, n) cin >> a[i].x;
  rep(i, 1, n) a[i].y = abs(a[i].x);
  sort(a + 1, a + n + 1);
  if (check())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}